]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
windowMenu: Use Clutter.Sprite for finding the pointer focus
authorCarlos Garnacho <carlosg@gnome.org>
Mon, 26 May 2025 15:23:30 +0000 (17:23 +0200)
committerMarge Bot <marge-bot@gnome.org>
Thu, 28 Aug 2025 20:15:40 +0000 (20:15 +0000)
Update to API updates in Mutter, by looking up the sprite and
using it in window drag API.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3726>

js/ui/windowMenu.js

index f30317d9a61ab6141757a11b33e9c885e089c22b..c140dee4dd77a0ce01d735e2b512f92c0f6eff5a 100644 (file)
@@ -1,4 +1,3 @@
-import Clutter from 'gi://Clutter';
 import Meta from 'gi://Meta';
 import St from 'gi://St';
 
@@ -56,19 +55,13 @@ export class WindowMenu extends PopupMenu.PopupMenu {
             item.setSensitive(false);
 
         item = this.addAction(_('Move'), event => {
-            const device = event.get_device();
-            const seat = device.get_seat();
-            const deviceType = device.get_device_type();
-            const pointer =
-                deviceType === Clutter.InputDeviceType.POINTER_DEVICE ||
-                deviceType === Clutter.InputDeviceType.TABLET_DEVICE ||
-                deviceType === Clutter.InputDeviceType.PEN_DEVICE ||
-                deviceType === Clutter.InputDeviceType.ERASER_DEVICE
-                    ? device : seat.get_pointer();
+            const backend = global.stage.get_context().get_backend();
+            const sprite = backend.get_sprite(global.stage, event) ||
+                backend.get_pointer_sprite(global.stage);
 
             window.begin_grab_op(
                 Meta.GrabOp.KEYBOARD_MOVING,
-                pointer, null,
+                sprite,
                 event.get_time(),
                 null);
         });
@@ -76,19 +69,13 @@ export class WindowMenu extends PopupMenu.PopupMenu {
             item.setSensitive(false);
 
         item = this.addAction(_('Resize'), event => {
-            const device = event.get_device();
-            const seat = device.get_seat();
-            const deviceType = device.get_device_type();
-            const pointer =
-                deviceType === Clutter.InputDeviceType.POINTER_DEVICE ||
-                deviceType === Clutter.InputDeviceType.TABLET_DEVICE ||
-                deviceType === Clutter.InputDeviceType.PEN_DEVICE ||
-                deviceType === Clutter.InputDeviceType.ERASER_DEVICE
-                    ? device : seat.get_pointer();
+            const backend = global.stage.get_context().get_backend();
+            const sprite = backend.get_sprite(global.stage, event) ||
+                backend.get_pointer_sprite(global.stage);
 
             window.begin_grab_op(
                 Meta.GrabOp.KEYBOARD_RESIZING_UNKNOWN,
-                pointer, null,
+                sprite,
                 event.get_time(),
                 null);
         });